# Contributor: Newbyte <newbyte@disroot.org>
# Maintainer: JuniorJPDJ <alpine@juniorjpdj.pl>
pkgname=py3-watchgod
pkgver=0.8.2
pkgrel=2
pkgdesc="Simple, modern file watching and code reload in Python"
url="https://github.com/samuelcolvin/watchfiles"
arch="noarch"
license="MIT"
depends="python3 py3-anyio"
makedepends="py3-setuptools"
checkdepends="py3-pytest py3-pytest-asyncio py3-pytest-mock py3-pytest-toolbox py3-trio"
subpackages="$pkgname-pyc"
source="$pkgname-v$pkgver.tar.gz::https://github.com/samuelcolvin/watchfiles/archive/refs/tags/v$pkgver.tar.gz"
builddir="$srcdir/watchfiles-$pkgver"

prepare() {
	default_prepare

	printf "__all__ = ('VERSION',)\n\nVERSION='%s'\n" "$pkgver" > watchgod/version.py
}

build() {
	python3 setup.py build
}

check() {
	# Fails on slow systems or when system is under heavy load.
	# See upstream issue #84
	pytest -k 'not test_awatch_log'
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="
a44b831352ace03c450781bc815b1813c44c386d666a9b724b562ff69228705651bfc23e81b7344d0f79c62577d4f910b323c734298e2a609f85bbc4a0f0498e  py3-watchgod-v0.8.2.tar.gz
"
